package com.coursehub.exercise.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Objects;

/**
 * 收藏题库题目关联复合主键
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Embeddable
public class FavoriteQuestionBankQuestionId implements Serializable {
    
    @Column(name = "favorite_question_bank_id", length = 100)
    private String favoriteQuestionBankId;
    
    @Column(name = "question_id", length = 100)
    private String questionId;
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FavoriteQuestionBankQuestionId that = (FavoriteQuestionBankQuestionId) o;
        return Objects.equals(favoriteQuestionBankId, that.favoriteQuestionBankId) && 
               Objects.equals(questionId, that.questionId);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(favoriteQuestionBankId, questionId);
    }
}